package com.example.room

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.Query
import androidx.room.Update
import com.example.common.User

@Dao
interface  UserDAO {
    @Insert
    suspend   fun insertAll(vararg users: User)

    @Delete
    suspend     fun delete(vararg user: User)

    @Query("SELECT * FROM users")
    suspend    fun getAll():List<User>

    @Update
    suspend    fun updateUser(vararg users:User):Int

    @Query("SELECT * FROM users WHERE name=:name")
    suspend   fun loadUserName(name:String):User

}